﻿<?xml version="1.0"?>
<xsl:stylesheet
   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:msxsl="urn:schemas-microsoft-com:xslt"
>
  <xsl:strip-space elements="*"/>  
  <xsl:output method="xml"
      omit-xml-declaration="yes"
      indent="yes"
      standalone="yes" />

  <xsl:template match="/TestRun">
    
    <xsl:for-each select="Results">
      <xsl:element name="Results">
        <xsl:for-each select="*">          
          <xsl:element name="TestResult">
            <xsl:if test="Comments">
              <xsl:attribute name="Comments">
                <xsl:value-of select="Comments"/>
              </xsl:attribute>
              <xsl:attribute name="testId">
                <xsl:value-of select="@testId"/>
              </xsl:attribute>
            </xsl:if>
            <xsl:if test="Output">                          
              <xsl:attribute name="Comments">                
                <xsl:value-of select="Output/ErrorInfo/Message"/>                
                <!--<xsl:value-of select="translate(Output/DebugTrace,'&#xA;          M',' ')"/>-->
              </xsl:attribute>             
              <xsl:attribute name="testId">
                <xsl:value-of select="@testId"/>
              </xsl:attribute>
            </xsl:if>            
          </xsl:element>
        </xsl:for-each>
      </xsl:element>
    </xsl:for-each>
    
  </xsl:template>
</xsl:stylesheet>